package com.sx.manage.service.consumer.feedback;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.sx.manage.biz.consumer.feedback.IMConsumerFeedbackBiz;
import com.sx.manage.servlet.ViewAndModel;
import com.sx.model.constants.type.consumer.feedback.MFeedBackStatus;
import com.sx.model.manage.mybatis.form.consumer.feedback.MConsumerFeedbackForm;
import com.sx.model.manage.mybatis.vo.consumer.feedback.MConsumerFeedbackVO;
import com.sx.model.manage.mybatis.vo.consumer.login.MConsumerLoginVO;
import com.sx.model.manage.mybatis.vo.result.ResultBooleanVO;
import com.sx.model.manage.mybatis.vo.result.ResultListVO;
import com.sx.model.manage.mybatis.vo.result.ResultObjectVO;

/**
 * 用户反馈反馈
 * @author Administrator
 *
 */

@Service("feedBackWebService")
public class MFeedBackWebService {
	/*** 日志 */
	private Logger log = LoggerFactory.getLogger(this.getClass());
	
	@Resource(name="consumerFeedbackBizImpl")
	private IMConsumerFeedbackBiz consumerFeedbackBizImpl;
	
	/**根据id查询用户反馈*/
	public ResultObjectVO<MConsumerFeedbackVO> queryById(Long id){
		log.info("根据id查询用户反馈明细id={}",id);
		return consumerFeedbackBizImpl.queryById(id);
	}

	/** 查询分页*/
	public ResultListVO<MConsumerFeedbackVO> queryPage(MConsumerFeedbackForm form){
		log.info("根据id查询用户反馈列表form={}",form);
		return consumerFeedbackBizImpl.queryPage(form);
	}
	/** 标记为已读**/
	public ResultBooleanVO signRead(MConsumerFeedbackForm form,MConsumerLoginVO loginVO) {
		form.setFeed_back_status(MFeedBackStatus.HAVE_READ);
		return consumerFeedbackBizImpl.updateStatus(form, loginVO);
	}
	/** 查看界面**/
	public ViewAndModel viewFeedBack(MConsumerFeedbackForm form,ViewAndModel model) {
		model.setViewName("consumer/personal/feedback/viewFeedBack");
		
		MConsumerFeedbackVO feedFackVO = consumerFeedbackBizImpl.queryById(form.getId()).getObjVo();
		model.addObject("feedFackVO", feedFackVO);
		return model;
	}
}
